package com;

/*
public class Fun {

    private static String name;
    private int age;

    public static void Func() {
        System.out.println(name);
    }

    public static void main(String[] args) {
        System.out.println(name);
    }
}
*/
class Func {

    {
        this.corse = 100;//定义在前面

    }
    private String name;
    private int age = 10;//定义在前面
    private int corse = 10000;

    private static int a;
    private static int b;
    //实例代码块
    {
        this.name = "李四";
        this.age = 20;
        System.out.println("corse="+this.corse);
        System.out.println("age="+this.age);
    }

    public static int getA() {
        return a;
    }

    public static void setA(int a) {
        Func.a = a;
    }

    public static int getB() {
        return b;
    }

    public static void setB(int b) {
        Func.b = b;
    }

    //静态代码块
    static {
        a = 10;
        b = 20;
        //System.out.println("a="+a+" "+"b="+b);
    }
    static {//第二个静态代码块
        a = 1000;
        b = 2000;
        //System.out.println("a="+a+" "+"b="+b);
    }
}
public class Fun {
    public static void main(String[] args) {
       Func func = new Func();
       //int A1 = func.getA();
        //System.out.println("A1="+A1);

//       Func func2 = new Func();
//       int A2 = func2.getA();
//        System.out.println("A2="+A2);
    }
}